Integrand size = 31, antiderivative size = 195 \[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=-\frac {B (b c-a d) n (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b d}+\frac {(a+b x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 b}-\frac {B (b c-a d)^2 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (A+B n+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b d^2}-\frac {B^2 (b c-a d)^2 n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b d^2} \]
-B*(-a*d+b*c)*n*(b*x+a)*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))/b/d+1/2*(b*x+a)^ 2*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2/b-B*(-a*d+b*c)^2*n*ln((-a*d+b*c)/b/( d*x+c))*(A+B*n+B*ln(e*(b*x+a)^n/((d*x+c)^n)))/b/d^2-B^2*(-a*d+b*c)^2*n^2*p olylog(2,d*(b*x+a)/b/(d*x+c))/b/d^2
Leaf count is larger than twice the leaf count of optimal. \(656\) vs. \(2(195)=390\).
Time = 0.52 (sec) , antiderivative size = 656, normalized size of antiderivative = 3.36 \[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=-\frac {2 a^2 A B n}{b}-\frac {2 a^2 B^2 n^2}{b}+\frac {a B^2 c n^2}{d}+a A^2 x+a A B n x-\frac {A b B c n x}{d}+\frac {1}{2} A^2 b x^2-\frac {a^2 B^2 n^2 \log ^2(a+b x)}{2 b}+\frac {A b B c^2 n \log (c+d x)}{d^2}-\frac {2 a A B c n \log (c+d x)}{d}-\frac {2 a^2 B^2 n^2 \log (c+d x)}{b}+\frac {b B^2 c^2 n^2 \log (c+d x)}{d^2}-\frac {a B^2 c n^2 \log (c+d x)}{d}+\frac {b B^2 c^2 n^2 \log ^2(c+d x)}{2 d^2}-\frac {a B^2 c n^2 \log ^2(c+d x)}{d}-\frac {2 a^2 B^2 n \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{b}+2 a A B x \log \left (e (a+b x)^n (c+d x)^{-n}\right )+a B^2 n x \log \left (e (a+b x)^n (c+d x)^{-n}\right )-\frac {b B^2 c n x \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d}+A b B x^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )+\frac {b B^2 c^2 n \log (c+d x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d^2}-\frac {2 a B^2 c n \log (c+d x) \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{d}+a B^2 x \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )+\frac {1}{2} b B^2 x^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )+\frac {B n \log (a+b x) \left (b B c (-b c+2 a d) n \log (c+d x)+B (b c-a d)^2 n \log \left (\frac {b (c+d x)}{b c-a d}\right )+a d \left (-b B c n+a d (A+3 B n)+a B d \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )\right )}{b d^2}+\frac {B^2 (b c-a d)^2 n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{-b c+a d}\right )}{b d^2} \]
(-2*a^2*A*B*n)/b - (2*a^2*B^2*n^2)/b + (a*B^2*c*n^2)/d + a*A^2*x + a*A*B*n *x - (A*b*B*c*n*x)/d + (A^2*b*x^2)/2 - (a^2*B^2*n^2*Log[a + b*x]^2)/(2*b) + (A*b*B*c^2*n*Log[c + d*x])/d^2 - (2*a*A*B*c*n*Log[c + d*x])/d - (2*a^2*B ^2*n^2*Log[c + d*x])/b + (b*B^2*c^2*n^2*Log[c + d*x])/d^2 - (a*B^2*c*n^2*L og[c + d*x])/d + (b*B^2*c^2*n^2*Log[c + d*x]^2)/(2*d^2) - (a*B^2*c*n^2*Log [c + d*x]^2)/d - (2*a^2*B^2*n*Log[(e*(a + b*x)^n)/(c + d*x)^n])/b + 2*a*A* B*x*Log[(e*(a + b*x)^n)/(c + d*x)^n] + a*B^2*n*x*Log[(e*(a + b*x)^n)/(c + d*x)^n] - (b*B^2*c*n*x*Log[(e*(a + b*x)^n)/(c + d*x)^n])/d + A*b*B*x^2*Log [(e*(a + b*x)^n)/(c + d*x)^n] + (b*B^2*c^2*n*Log[c + d*x]*Log[(e*(a + b*x) ^n)/(c + d*x)^n])/d^2 - (2*a*B^2*c*n*Log[c + d*x]*Log[(e*(a + b*x)^n)/(c + d*x)^n])/d + a*B^2*x*Log[(e*(a + b*x)^n)/(c + d*x)^n]^2 + (b*B^2*x^2*Log[ (e*(a + b*x)^n)/(c + d*x)^n]^2)/2 + (B*n*Log[a + b*x]*(b*B*c*(-(b*c) + 2*a *d)*n*Log[c + d*x] + B*(b*c - a*d)^2*n*Log[(b*(c + d*x))/(b*c - a*d)] + a* d*(-(b*B*c*n) + a*d*(A + 3*B*n) + a*B*d*Log[(e*(a + b*x)^n)/(c + d*x)^n])) )/(b*d^2) + (B^2*(b*c - a*d)^2*n^2*PolyLog[2, (d*(a + b*x))/(-(b*c) + a*d) ])/(b*d^2)
Time = 0.57 (sec) , antiderivative size = 224, normalized size of antiderivative = 1.15, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {2973, 2949, 2781, 2784, 2754, 2838}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int (a+b x) \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2 \, dx\) |
\(\Big \downarrow \) 2973 |
\(\displaystyle \int (a+b x) \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2dx\) |
\(\Big \downarrow \) 2949 |
\(\displaystyle (b c-a d)^2 \int \frac {(a+b x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )^3}d\frac {a+b x}{c+d x}\) |
\(\Big \downarrow \) 2781 |
\(\displaystyle (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {B n \int \frac {(a+b x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{(c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )^2}d\frac {a+b x}{c+d x}}{b}\right )\) |
\(\Big \downarrow \) 2784 |
\(\displaystyle (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {B n \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {\int \frac {A+B n+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b-\frac {d (a+b x)}{c+d x}}d\frac {a+b x}{c+d x}}{d}\right )}{b}\right )\) |
\(\Big \downarrow \) 2754 |
\(\displaystyle (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {B n \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {\frac {B n \int \frac {(c+d x) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{d}-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A+B n\right )}{d}}{d}\right )}{b}\right )\) |
\(\Big \downarrow \) 2838 |
\(\displaystyle (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {B n \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A+B n\right )}{d}-\frac {B n \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{d}}{d}\right )}{b}\right )\) |
(b*c - a*d)^2*(((a + b*x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2)/(2*b *(c + d*x)^2*(b - (d*(a + b*x))/(c + d*x))^2) - (B*n*(((a + b*x)*(A + B*Lo g[e*((a + b*x)/(c + d*x))^n]))/(d*(c + d*x)*(b - (d*(a + b*x))/(c + d*x))) - (-(((A + B*n + B*Log[e*((a + b*x)/(c + d*x))^n])*Log[1 - (d*(a + b*x))/ (b*(c + d*x))])/d) - (B*n*PolyLog[2, (d*(a + b*x))/(b*(c + d*x))])/d)/d))/ b)
3.2.58.3.1 Defintions of rubi rules used
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symb ol] :> Simp[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^p/e), x] - Simp[b*n*(p/e) Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{a, b, c, d, e, n}, x] && IGtQ[p, 0]
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_))^(q_), x_Symbol] :> Simp[(-(f*x)^(m + 1))*(d + e*x)^(q + 1)*((a + b*Log[c*x^n])^p/(d*f*(q + 1))), x] + Simp[b*n*(p/(d*(q + 1))) Int[(f*x) ^m*(d + e*x)^(q + 1)*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, d, e, f, m, n, q}, x] && EqQ[m + q + 2, 0] && IGtQ[p, 0] && LtQ[q, -1]
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((f_.)*(x_))^(m_.)*((d_) + (e_.)* (x_))^(q_.), x_Symbol] :> Simp[(f*x)^m*(d + e*x)^(q + 1)*((a + b*Log[c*x^n] )/(e*(q + 1))), x] - Simp[f/(e*(q + 1)) Int[(f*x)^(m - 1)*(d + e*x)^(q + 1)*(a*m + b*n + b*m*Log[c*x^n]), x], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && ILtQ[q, -1] && GtQ[m, 0]
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 , (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d)^(m + 1)*(g/b)^m Subst[Int[x^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m + 2)), x], x, (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B, n}, x] && Ne Q[b*c - a*d, 0] && IntegersQ[m, p] && EqQ[b*f - a*g, 0] && (GtQ[p, 0] || Lt Q[m, -1])
Int[((A_.) + Log[(e_.)*(u_)^(n_.)*(v_)^(mn_)]*(B_.))^(p_.)*(w_.), x_Symbol] :> Subst[Int[w*(A + B*Log[e*(u/v)^n])^p, x], e*(u/v)^n, e*(u^n/v^n)] /; Fr eeQ[{e, A, B, n, p}, x] && EqQ[n + mn, 0] && LinearQ[{u, v}, x] && !Intege rQ[n]
Result contains higher order function than in optimal. Order 9 vs. order 4.
Time = 37.57 (sec) , antiderivative size = 4394, normalized size of antiderivative = 22.53
1/2*B^2*x*(b*x+2*a)*ln((d*x+c)^n)^2+5/4/d^2*n^2*B^2*b*c^2-3/2/d*n^2*B^2*a* c+1/4*B^2*a^2*n^2/b+B^2*n*ln((b*x+a)^n)*x*a-1/2*B^2/b*n^2*a^2*ln(b*x+a)^2+ (-B^2*x*(b*x+2*a)*ln((b*x+a)^n)-1/2*B*(2*A*b^2*d^2*x^2+2*B*a*b*d^2*n*x-2*B *b^2*c*d*n*x+2*B*ln(d*x+c)*b^2*c^2*n+4*B*ln(e)*a*b*d^2*x+4*A*a*b*d^2*x+2*B *a^2*n*ln(b*x+a)*d^2+2*B*ln(e)*b^2*d^2*x^2-4*B*ln(d*x+c)*a*b*c*d*n+I*B*Pi* b^2*d^2*x^2*csgn(I/((d*x+c)^n))*csgn(I*(b*x+a)^n/((d*x+c)^n))^2+I*B*Pi*b^2 *d^2*x^2*csgn(I*(b*x+a)^n/((d*x+c)^n))*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)^2-2 *I*B*Pi*a*b*d^2*x*csgn(I*e)*csgn(I*(b*x+a)^n/((d*x+c)^n))*csgn(I*e/((d*x+c )^n)*(b*x+a)^n)-2*I*B*Pi*a*b*d^2*x*csgn(I*(b*x+a)^n)*csgn(I/((d*x+c)^n))*c sgn(I*(b*x+a)^n/((d*x+c)^n))-I*B*Pi*b^2*d^2*x^2*csgn(I*(b*x+a)^n)*csgn(I/( (d*x+c)^n))*csgn(I*(b*x+a)^n/((d*x+c)^n))+2*I*B*Pi*a*b*d^2*x*csgn(I*e)*csg n(I*e/((d*x+c)^n)*(b*x+a)^n)^2+I*B*Pi*b^2*d^2*x^2*csgn(I*e)*csgn(I*e/((d*x +c)^n)*(b*x+a)^n)^2+I*B*Pi*b^2*d^2*x^2*csgn(I*(b*x+a)^n)*csgn(I*(b*x+a)^n/ ((d*x+c)^n))^2-2*I*B*Pi*a*b*d^2*x*csgn(I*(b*x+a)^n/((d*x+c)^n))^3-2*I*B*Pi *a*b*d^2*x*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)^3-I*B*Pi*b^2*d^2*x^2*csgn(I*(b* x+a)^n/((d*x+c)^n))^3-I*B*Pi*b^2*d^2*x^2*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)^3 +2*I*B*Pi*a*b*d^2*x*csgn(I*(b*x+a)^n)*csgn(I*(b*x+a)^n/((d*x+c)^n))^2+2*I* B*Pi*a*b*d^2*x*csgn(I/((d*x+c)^n))*csgn(I*(b*x+a)^n/((d*x+c)^n))^2+2*I*B*P i*a*b*d^2*x*csgn(I*(b*x+a)^n/((d*x+c)^n))*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)^ 2-I*B*Pi*b^2*d^2*x^2*csgn(I*e)*csgn(I*(b*x+a)^n/((d*x+c)^n))*csgn(I*e/(...
\[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\int { {\left (b x + a\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A\right )}^{2} \,d x } \]
integral(A^2*b*x + A^2*a + (B^2*b*x + B^2*a)*log((b*x + a)^n*e/(d*x + c)^n )^2 + 2*(A*B*b*x + A*B*a)*log((b*x + a)^n*e/(d*x + c)^n), x)
Exception generated. \[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\text {Exception raised: HeuristicGCDFailed} \]
Leaf count of result is larger than twice the leaf count of optimal. 779 vs. \(2 (192) = 384\).
Time = 0.69 (sec) , antiderivative size = 779, normalized size of antiderivative = 3.99 \[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=A B b x^{2} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + \frac {1}{2} \, A^{2} b x^{2} + 2 \, A B a x \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A^{2} a x + \frac {2 \, {\left (\frac {a e n \log \left (b x + a\right )}{b} - \frac {c e n \log \left (d x + c\right )}{d}\right )} A B a}{e} - \frac {{\left (\frac {a^{2} e n \log \left (b x + a\right )}{b^{2}} - \frac {c^{2} e n \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b c e n - a d e n\right )} x}{b d}\right )} A B b}{e} + \frac {{\left ({\left (n^{2} + n \log \left (e\right )\right )} b c^{2} - {\left (n^{2} + 2 \, n \log \left (e\right )\right )} a c d\right )} B^{2} \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b^{2} c^{2} n^{2} - 2 \, a b c d n^{2} + a^{2} d^{2} n^{2}\right )} {\left (\log \left (b x + a\right ) \log \left (\frac {b d x + a d}{b c - a d} + 1\right ) + {\rm Li}_2\left (-\frac {b d x + a d}{b c - a d}\right )\right )} B^{2}}{b d^{2}} - \frac {B^{2} a^{2} d^{2} n^{2} \log \left (b x + a\right )^{2} - B^{2} b^{2} d^{2} x^{2} \log \left (e\right )^{2} + 2 \, {\left (b^{2} c^{2} n^{2} - 2 \, a b c d n^{2}\right )} B^{2} \log \left (b x + a\right ) \log \left (d x + c\right ) - {\left (b^{2} c^{2} n^{2} - 2 \, a b c d n^{2}\right )} B^{2} \log \left (d x + c\right )^{2} + 2 \, {\left (b^{2} c d n \log \left (e\right ) - {\left (n \log \left (e\right ) + \log \left (e\right )^{2}\right )} a b d^{2}\right )} B^{2} x + 2 \, {\left (a b c d n^{2} - {\left (n^{2} + n \log \left (e\right )\right )} a^{2} d^{2}\right )} B^{2} \log \left (b x + a\right ) - {\left (B^{2} b^{2} d^{2} x^{2} + 2 \, B^{2} a b d^{2} x\right )} \log \left ({\left (b x + a\right )}^{n}\right )^{2} - {\left (B^{2} b^{2} d^{2} x^{2} + 2 \, B^{2} a b d^{2} x\right )} \log \left ({\left (d x + c\right )}^{n}\right )^{2} - 2 \, {\left (B^{2} b^{2} d^{2} x^{2} \log \left (e\right ) + B^{2} a^{2} d^{2} n \log \left (b x + a\right ) + {\left (a b d^{2} {\left (n + 2 \, \log \left (e\right )\right )} - b^{2} c d n\right )} B^{2} x + {\left (b^{2} c^{2} n - 2 \, a b c d n\right )} B^{2} \log \left (d x + c\right )\right )} \log \left ({\left (b x + a\right )}^{n}\right ) + 2 \, {\left (B^{2} b^{2} d^{2} x^{2} \log \left (e\right ) + B^{2} a^{2} d^{2} n \log \left (b x + a\right ) + {\left (a b d^{2} {\left (n + 2 \, \log \left (e\right )\right )} - b^{2} c d n\right )} B^{2} x + {\left (b^{2} c^{2} n - 2 \, a b c d n\right )} B^{2} \log \left (d x + c\right ) + {\left (B^{2} b^{2} d^{2} x^{2} + 2 \, B^{2} a b d^{2} x\right )} \log \left ({\left (b x + a\right )}^{n}\right )\right )} \log \left ({\left (d x + c\right )}^{n}\right )}{2 \, b d^{2}} \]
A*B*b*x^2*log((b*x + a)^n*e/(d*x + c)^n) + 1/2*A^2*b*x^2 + 2*A*B*a*x*log(( b*x + a)^n*e/(d*x + c)^n) + A^2*a*x + 2*(a*e*n*log(b*x + a)/b - c*e*n*log( d*x + c)/d)*A*B*a/e - (a^2*e*n*log(b*x + a)/b^2 - c^2*e*n*log(d*x + c)/d^2 + (b*c*e*n - a*d*e*n)*x/(b*d))*A*B*b/e + ((n^2 + n*log(e))*b*c^2 - (n^2 + 2*n*log(e))*a*c*d)*B^2*log(d*x + c)/d^2 + (b^2*c^2*n^2 - 2*a*b*c*d*n^2 + a^2*d^2*n^2)*(log(b*x + a)*log((b*d*x + a*d)/(b*c - a*d) + 1) + dilog(-(b* d*x + a*d)/(b*c - a*d)))*B^2/(b*d^2) - 1/2*(B^2*a^2*d^2*n^2*log(b*x + a)^2 - B^2*b^2*d^2*x^2*log(e)^2 + 2*(b^2*c^2*n^2 - 2*a*b*c*d*n^2)*B^2*log(b*x + a)*log(d*x + c) - (b^2*c^2*n^2 - 2*a*b*c*d*n^2)*B^2*log(d*x + c)^2 + 2*( b^2*c*d*n*log(e) - (n*log(e) + log(e)^2)*a*b*d^2)*B^2*x + 2*(a*b*c*d*n^2 - (n^2 + n*log(e))*a^2*d^2)*B^2*log(b*x + a) - (B^2*b^2*d^2*x^2 + 2*B^2*a*b *d^2*x)*log((b*x + a)^n)^2 - (B^2*b^2*d^2*x^2 + 2*B^2*a*b*d^2*x)*log((d*x + c)^n)^2 - 2*(B^2*b^2*d^2*x^2*log(e) + B^2*a^2*d^2*n*log(b*x + a) + (a*b* d^2*(n + 2*log(e)) - b^2*c*d*n)*B^2*x + (b^2*c^2*n - 2*a*b*c*d*n)*B^2*log( d*x + c))*log((b*x + a)^n) + 2*(B^2*b^2*d^2*x^2*log(e) + B^2*a^2*d^2*n*log (b*x + a) + (a*b*d^2*(n + 2*log(e)) - b^2*c*d*n)*B^2*x + (b^2*c^2*n - 2*a* b*c*d*n)*B^2*log(d*x + c) + (B^2*b^2*d^2*x^2 + 2*B^2*a*b*d^2*x)*log((b*x + a)^n))*log((d*x + c)^n))/(b*d^2)
\[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\int { {\left (b x + a\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A\right )}^{2} \,d x } \]
Timed out. \[ \int (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\int {\left (A+B\,\ln \left (\frac {e\,{\left (a+b\,x\right )}^n}{{\left (c+d\,x\right )}^n}\right )\right )}^2\,\left (a+b\,x\right ) \,d x \]